import time
from zhipuai import ZhipuAI
client = ZhipuAI(api_key="a31cc1500ce8aa88e1778e57cb431c81.wbIvrk5PGWD5IJjI_add_none_kkk")#这个api是不对的需要二次更改哈

result = client.files.create(
    file=open("test.jsonl", "rb"),
    purpose="batch"
)
id=result.id

create = client.batches.create(
    input_file_id=id,
    endpoint="/v4/chat/completions", 
    completion_window="24h", #完成时间只支持 24 小时
    metadata={
        "description": "Sentiment classification"
    }
)

with open("batchid.txt","w",encoding="utf-8") as f:
     f.write(create.id+"\n") 
print("ur_batch_id:",create.id)

